package com.hamster.crmpre.web;

import com.hamster.crmpre.pojo.CourseTask;
import com.hamster.crmpre.pojo.CustomerCourseTask;
import com.hamster.crmpre.service.CourseTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Tarry
 * @create 2019/12/30 17:32
 */
@RestController
@RequestMapping("courseTask")
public class CourseTaskController {

    @Autowired
    private CourseTaskService courseTaskService;

//    /**
//     * 查询 客户的参课任务 详情
//     * @param customerId   客户的id
//     * @param courseTaskId 参课任务的id
//     * @return
//     */
//    @GetMapping("getDetail")
//    public ResponseEntity<CustomerCourseTask> getDetail(@RequestParam String customerId,@RequestParam String courseTaskId){
//
//        CustomerCourseTask customerCourseTask = courseTaskService.getDetail(customerId,courseTaskId);
//        return ResponseEntity.ok(customerCourseTask);
//    }

    /**
     * 查询该员工手下的 客户的  该参课任务的列表
     * @param courseTaskId 参课任务的id
     * @return
     */
    @GetMapping("listCustomerCourse")
    public ResponseEntity<List<CustomerCourseTask>> listCustomerCourse(@RequestParam String courseTaskId){
        List<CustomerCourseTask> list = courseTaskService.listCustomerCourse(courseTaskId);
        return ResponseEntity.ok(list);
    }

    /**
     * 保存参课任务结果
     * @param customerCourseTask
     * @return
     */
    @PostMapping("insertCustomerTask")
    public ResponseEntity<Void> insertCustomerTask(@RequestBody CustomerCourseTask customerCourseTask){
        courseTaskService.insertCustomerTask(customerCourseTask);
        return ResponseEntity.ok().build();
    }

    /**
     * 获取 参课任务列表
     * @return
     */
    @GetMapping("listCourseTask")
    public List<CourseTask> listCourseTask(){

        return courseTaskService.listCourseTask();
    }

}
